a0d42ce32d1fa9b9879908f102cd3e355465a027,src/test/java/org/zeroturnaround/exec/test/shutdown/ProcessExecutorShutdownHookTest.java,ProcessExecutorShutdownHookTest,testDestroyOnExit,#Class#,47

Before Change


    new ProcessExecutor("java", "-cp", SystemUtils.JAVA_CLASS_PATH, starter.getName()).redirectOutputAsInfo().execute();
    // After WriterLoopStarter has finished we expect that WriterLoop is also finished - no-one is updating the file
    checkFileStaysTheSame(file);
    FileUtils.forceDelete(file);
  }

  private static void checkFileStaysTheSame(File file) throws InterruptedException {

After Change


      FileUtils.forceDelete(file);
    new ProcessExecutor("java", "-cp", SystemUtils.JAVA_CLASS_PATH, starter.getName()).redirectOutputAsInfo().execute();
    // After WriterLoopStarter has finished we expect that WriterLoop is also finished - no-one is updating the file
    if (fileIsAlwaysCreated || file.exists()) {
      checkFileStaysTheSame(file);
      FileUtils.forceDelete(file);
    }
  }